package net.stogi.dsper.ui.client.module.dataobject;

import net.stogi.dsper.api.dto.DataObjectDto;

import com.google.gwt.event.shared.GwtEvent;

public class OpenDataObjectPreviewEvent extends GwtEvent<OpenDataObjectPreviewHandler> {

	public static final GwtEvent.Type<OpenDataObjectPreviewHandler> TYPE = new GwtEvent.Type<OpenDataObjectPreviewHandler>();

	private DataObjectDto dataObject;

	public OpenDataObjectPreviewEvent(DataObjectDto dataObject) {
		this.dataObject = dataObject;
	}

	@SuppressWarnings("unused")
	private OpenDataObjectPreviewEvent() {}

	@Override
	public Type<OpenDataObjectPreviewHandler> getAssociatedType() {
		return TYPE;
	}

	/**
	 * @return the dataObject
	 */
	public DataObjectDto getDataObject() {
		return dataObject;
	}

	/**
	 * @param dataObject
	 *          the dataObject to set
	 */
	public void setDataObject(DataObjectDto dataObject) {
		this.dataObject = dataObject;
	}

	@Override
	protected void dispatch(OpenDataObjectPreviewHandler handler) {
		handler.onOpenDataObjectPreview(this);
	}
}
